/*
 * clients.h
 *
 *  Created on: 2012. 4. 12.
 *      Author: jphong
 */

#ifndef CLIENTS_H_
#define CLIENTS_H_

#include 	"readBuffer.h"

#define	MAXID	128

typedef struct cl {
	int connfd; // connected socket for this client
	char * user; // Client's user ID

	char * ipaddr;
	int port;

	ReadBuffer * readBuffer; // Client's buffer for message reception
	struct cl * next;
} Client;

Client * getClientList();
char * getUser(const Client *client);
int getSocket(const Client *client);
Client * findClient(const char *userID);
Client * createClient(int connfd);
void destroyClient(Client *client);
ssize_t readClient(Client *client);

#endif /* CLIENTS_H_ */
